# respondent head of household (hh)
summary(survey$F1)
## no way of idenifying
survey$hh <- factor(dplyr::recode(survey$F1,
`1` = "Yes",
`2` = "Yes",
`3` = "No",
`4` = "No",
`5` = "No",
`6` = "No"))
# increasing inequality (inequality)
summary(survey$Q2A_2)
survey$inequality <- factor(dplyr::recode(as.character(survey$Q2A_2),
`1` = "Feel",
`2` = "Don't Feel",
`3` = "Not Sure"))
summary(survey$inequality)
table(survey$Q2A_2)
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
table(survey$F6A_1)
survey$union.self <- dplyr::recode(survey$F6A_1,
`0` = "No",
`1` = "Yes")
table(survey$union.self)
survey$union.other <- dplyr::recode(survey$F6A_2,
`0` = "No",
`1` = "Yes")
table(survey$union.other)
summary(survey$F6A_4) # not sure
survey[!is.na(survey$F6A_4) & survey$F6A_4 == 1, c("union.self", "union.other", "F6A_3")]
survey$union.self[!is.na(survey$F6A_4) & survey$F6A_4 == 1] <- "Not Sure"
survey$union.other[!is.na(survey$F6A_4) & survey$F6A_4 == 1] <- "Not Sure"
survey$union.self <- factor(survey$union.self)
survey$union.other <- factor(survey$union.other)
# employment (employed)
table(survey$F2A)
survey$employed <- factor(dplyr::recode(survey$F2A,
`1` = "Hourly wage worker",
`2` = "Salaried",
`3` = "Self-employed",
`4` = "Retired",
`5` = "Unemployed",
`6` = "Student",
`7` = "Military service",
`8` = "Housewife",
`9` = "Other (specify)"))
# occupation
survey$occupation <- factor(dplyr::recode(survey$F2B,
`1` = "Professional",
`2` = "Manager, official, proprietor",
`3` = "Clerical worker",
`4` = "Sales worker",
`5` = "Skilled craftsman, foreman",
`6` = "Operative, unskilled laborer (except farm)",
`7` = "Service worker",
`8` = "Farmer, farm manager, farm laborer",
`9` = "Other (specify)"))
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
table(survey$F5)
survey$educ <- recode(survey$F5,
`1` = "Less than high school",
`2` = "Less than high school",
`3` = "Less than high school",
`4` = "Less than high school",
`5` = "High school graduate",
`6` = "Some college",
`7` = "Some college",
`8` = "College graduate",
`9` = "Post graduate")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate",
"Some college", "College graduate", "Post graduate"),
labels =  c("Less than high school", "High school graduate",
"Some college", "College graduate", "Post graduate"),
ordered = TRUE)
table(survey$educ)
# household income (income)
survey$income <- factor(dplyr::recode(survey$F7,
`1` = "Under $3000",
`2` = "$3,000 to $4,999",
`3` = "$5,000 to $6,999",
`4` = "$7,000 to $9,999",
`5` = "10,000 to $14,999",
`6` = "15,000 to $19,999",
`7` = "20,000 to $24,999",
`8` = "25,000 and over",
`9` = "Not sure/refused"))
# age
survey$age <- factor(dplyr::recode(survey$F4,
`1` = "18 to 20",
`2` = "21 to 24",
`3` = "25 to 29",
`4` = "30 to 34",
`5` = "35 to 39",
`6` = "40 to 49",
`7` = "50 to 64",
`8` = "65 and over",
`9` = "Refused"))
# race
survey$race <- factor(dplyr::recode(survey$F10,
`1` = "White",
`2` = "Black",
`3` = "Oriental",
`4` = "Spanish-American (Puerto Rican, Mexican-American)",
`5` = "Other (specify)",
`6` = "Not sure"))
summary(survey$race)
# politics (party)
survey$party <- factor(dplyr::recode(survey$Q1C,
`1` = "Republican",
`2` = "Democrat",
`3` = "Independent",
`4` = "Other (vol.)",
`5` = "Not sure"))
# politics (ideology)
survey$ideology <- factor(dplyr::recode(survey$Q2B,
`1` = "Conservative",
`2` = "Middle of the road",
`3` = "Liberal",
`4` = "Radical",
`5` = "Not sure"))
table(survey$ideology)
# gender
survey$gender <- factor(dplyr::recode(survey$F11,
`1` = "Male",
`2` = "Female"))
table(survey$gender)
# religion
survey$religion <- factor(dplyr::recode(survey$F8,
`1` = "Protestant",
`2` = "Catholic",
`3` = "Jewish",
`4` = "Other (write in)",
`5` = "None",
`6` = "Not sure"))
table(survey$religion)
# subset
survey_2624 <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
summary(survey_2624)
setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1978 Attitudes Toward Racial and Religious Minorities and Toward Women, study no. S2829")
library(dplyr)
library(tidyr)
library(car)
library(readstata13)
survey <- read.dta13("harris_s2829_white_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 2829
# study year (year)
survey$year <- 1978
# geographic data (urban)
survey$urban <- car::recode(survey$S13, "'Central City' = 'Urban'; 'Town' = 'Rural';
'Suburb' = 'Suburban'; 'Rural' = 'Rural'")
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- NA
# survey$hh <- car::recode(survey$F1, "c('Male head', 'Female head (no male head)') = 'Yes';
# c('Wife', 'Son', 'Daughter', 'Other (specify)') = 'No'; else = NA")
# increasing inequality (inequality)
survey$inequality <- car::recode(survey$Q13_2, "'Don t Feel' = 'Don t feel'; 'Not Sure' = 'Not sure'")
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- survey$F5_1 # already harmonized
# union (union.other)
survey$union.other <- survey$F5_2 # already harmonized
# employment (employed)
survey$employed <- survey$F1A
# occupation
survey$occupation <- survey$F1B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- as.numeric(survey$F4)
survey$educ <- car::recode(survey$educ, "c(1, 2, 3, 4) = 'Less than high school';
5 = 'High school graduate';
c(6, 7) = 'Some college';
8 = 'College graduate';
9 = 'Post graduate';
else = 'NA'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F6
# age
survey$age <- survey$F3
# race
survey$race <- survey$F7
# politics (party)
survey$party <- survey$Q24C
# politics (ideology)
survey$ideology <- NA
# gender
survey$gender <- survey$F8
# religion
survey$religion <- NA
# subset
survey_2829 <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
summary(survey_2829)
setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1978 Attitudes Toward Racial and Religious Minorities and Toward Women, study no. S2829")
library(dplyr)
library(tidyr)
library(car)
library(readstata13)
survey <- read.dta13("harris_s2829_white_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 2829
# study year (year)
survey$year <- 1978
# geographic data (urban)
survey$urban <- car::recode(survey$S13, "'Central City' = 'Urban'; 'Town' = 'Rural';
'Suburb' = 'Suburban'; 'Rural' = 'Rural'")
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- NA
# survey$hh <- car::recode(survey$F1, "c('Male head', 'Female head (no male head)') = 'Yes';
# c('Wife', 'Son', 'Daughter', 'Other (specify)') = 'No'; else = NA")
# increasing inequality (inequality)
survey$inequality <- car::recode(survey$Q13_2, "'Don t Feel' = 'Don t feel'; 'Not Sure' = 'Not sure'")
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- survey$F5_1 # already harmonized
# union (union.other)
survey$union.other <- survey$F5_2 # already harmonized
# employment (employed)
survey$employed <- survey$F1A
# occupation
survey$occupation <- survey$F1B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- as.numeric(survey$F4)
survey$educ <- car::recode(survey$educ, "c(1, 2, 3, 4) = 'Less than high school';
5 = 'High school graduate';
c(6, 7) = 'Some college';
8 = 'College graduate';
9 = 'Post graduate';
else = 'NA'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F6
# age
survey$age <- survey$F3
# race
survey$race <- survey$F7
# politics (party)
survey$party <- survey$Q24C
# politics (ideology)
survey$ideology <- NA
# gender
survey$gender <- survey$F8
# religion
survey$religion <- NA
# subset
survey_2829 <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
summary(survey_2829)
survey$urban <- factor(dplyr::recode(survey$S13,
`Central City` = "Urban",
`Town` = "Rural",
`Suburb` = "Suburban"))
summary(survey$urban)
survey$urban <- factor(dplyr::recode(survey$S13,
`Central city` = "Urban",
`Town` = "Rural",
`Suburb` = "Suburban"))
summary(survey$urban)
survey$urban <- car::recode(survey$S13, "'Central city' = 'Urban'; 'Town' = 'Rural';
'Suburb' = 'Suburban'; 'Rural' = 'Rural'")
summary(survey$urban)
survey <- read.dta13("harris_s2829_white_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 2829
# study year (year)
survey$year <- 1978
# geographic data (urban)
survey$urban <- car::recode(survey$S13, "'Central city' = 'Urban'; 'Town' = 'Rural';
'Suburb' = 'Suburban'; 'Rural' = 'Rural'")
summary(survey$urban)
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- NA
# survey$hh <- car::recode(survey$F1, "c('Male head', 'Female head (no male head)') = 'Yes';
# c('Wife', 'Son', 'Daughter', 'Other (specify)') = 'No'; else = NA")
# increasing inequality (inequality)
survey$inequality <- car::recode(survey$Q13_2, "'Don t Feel' = 'Don t feel'; 'Not Sure' = 'Not sure'")
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- survey$F5_1 # already harmonized
# union (union.other)
survey$union.other <- survey$F5_2 # already harmonized
# employment (employed)
survey$employed <- survey$F1A
# occupation
survey$occupation <- survey$F1B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- as.numeric(survey$F4)
survey$educ <- car::recode(survey$educ, "c(1, 2, 3, 4) = 'Less than high school';
5 = 'High school graduate';
c(6, 7) = 'Some college';
8 = 'College graduate';
9 = 'Post graduate';
else = 'NA'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F6
# age
survey$age <- survey$F3
# race
survey$race <- survey$F7
# politics (party)
survey$party <- survey$Q24C
# politics (ideology)
survey$ideology <- NA
# gender
survey$gender <- survey$F8
# religion
survey$religion <- NA
# subset
survey_2829 <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
summary(survey_2829)
saveRDS(survey_2829, file = "survey_2829-white.rds")
setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1978 Attitudes Toward Racial and Religious Minorities and Toward Women, study no. S2829")
setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1978 Attitudes Toward Racial and Religious Minorities and Toward Women, study no. S2829")
library(dplyr)
library(tidyr)
library(car)
library(readstata13)
survey <- read.dta13("harris_s2829_black_sas.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 2829
# study year (year)
survey$year <- 1978
# geographic data (urban)
# survey$urban <- car::recode(survey$S13, "'Central City' = 'Urban'; 'Town' = 'Rural';
# 'Suburb' = 'Suburban'; 'Rural' = 'Rural'")
survey$urban <- NA
# geographic data (region)
# survey$region <- survey$S11
# levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
#  South=c("South_(3)", "South_(4)"),
#  West=c("West_(7)", "West_(8)"))
survey$region <- NA
# respondent head of household (hh)
survey$hh <- NA
# survey$hh <- car::recode(survey$F1, "c('Male head', 'Female head (no male head)') = 'Yes';
# c('Wife', 'Son', 'Daughter', 'Other (specify)') = 'No'; else = NA")
# increasing inequality (inequality)
survey$inequality <- car::recode(survey$Q13_2, "'Don t Feel' = 'Don t feel'; 'Not Sure' = 'Not sure'")
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- survey$F5_1 # already harmonized
# union (union.other)
survey$union.other <- survey$F5_2 # already harmonized
# employment (employed)
survey$employed <- survey$F1A
# occupation
survey$occupation <- survey$F1B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- as.numeric(survey$F4)
survey$educ <- car::recode(survey$educ, "c(1, 2, 3, 4) = 'Less than high school';
5 = 'High school graduate';
c(6, 7) = 'Some college';
8 = 'College graduate';
9 = 'Post graduate';
else = 'NA'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F6
# age
survey$age <- survey$F3
# race
survey$race <- survey$F7
# politics (party)
survey$party <- survey$Q24C
# politics (ideology)
survey$ideology <- NA
# gender
survey$gender <- survey$F8
# religion
survey$religion <- NA
# subset
survey_2829 <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
summary(survey_2829)
setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1978 Attitudes Toward Racial and Religious Minorities and Toward Women, study no. S2829")
library(dplyr)
library(tidyr)
library(car)
library(readstata13)
survey <- read.dta13("harris_s2829_white_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 2829
# study year (year)
survey$year <- 1978
# geographic data (urban)
survey$urban <- car::recode(survey$S13, "'Central city' = 'Urban'; 'Town' = 'Rural';
'Suburb' = 'Suburban'; 'Rural' = 'Rural'")
summary(survey$urban)
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- NA
# survey$hh <- car::recode(survey$F1, "c('Male head', 'Female head (no male head)') = 'Yes';
# c('Wife', 'Son', 'Daughter', 'Other (specify)') = 'No'; else = NA")
# increasing inequality (inequality)
survey$inequality <- car::recode(survey$Q13_2, "'Don t Feel' = 'Don t feel'; 'Not Sure' = 'Not sure'")
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- as.character(survey$F5_1)
survey$union.self[survey$F5_4 == "Yes"] <- "Not Sure"
survey$union.self <- factor(survey$union.self)
survey$union.other <- as.character(survey$F5_2)
survey$union.other[survey$F5_4 == "Yes"] <- "Not Sure"
survey$union.other <- factor(survey$union.other)
# employment (employed)
survey$employed <- survey$F1A
# occupation
survey$occupation <- survey$F1B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- as.numeric(survey$F4)
survey$educ <- car::recode(survey$educ, "c(1, 2, 3, 4) = 'Less than high school';
5 = 'High school graduate';
c(6, 7) = 'Some college';
8 = 'College graduate';
9 = 'Post graduate';
else = 'NA'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F6
# age
survey$age <- survey$F3
# race
survey$race <- survey$F7
# politics (party)
survey$party <- survey$Q24C
# politics (ideology)
survey$ideology <- NA
# gender
survey$gender <- survey$F8
# religion
survey$religion <- NA
# subset
survey_2829 <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
summary(survey_2829)
saveRDS(survey_2829, file = "survey_2829-white.rds")
